/**
 * Created by charlie on 18-1-18.
 */
import { getZhengGaiDan } from '../../services/zhengGaiDan'

export default {
    namespace:'zhangGaiDan',
    state:{
        data:[],
        loading:true
    },
    subscriptions:{

    },
    effects:{
        *getDetail({payload},{call,put,select}){
            const {taskId} = yield select(state =>state.masterTaskList);
            const {json, error}=yield call(getZhengGaiDan, {taskId:taskId});
            if (error) {
                yield put({type: 'cleanLoading'})
            } else {
                yield put({type: 'querySuccess', payload: json.data})
            }
        }
    },
    reducers:{
        querySuccess(state,{payload}){
            return {...state,data:payload,loading:false}
        },
        cleanLoading(state,{payload}){
            return{...state,loading:false}
        },
        getClean(state,{payload}){
            return {...state,loading:true}
        }
    }
}